<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>librf: resumef::event_t结构体 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">librf
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>resumef</b></li><li class="navelem"><a class="el" href="structresumef_1_1event__t.html">event_t</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="structresumef_1_1event__t-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">resumef::event_t结构体 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p>用于协程的事件。  
 <a href="structresumef_1_1event__t.html#details">更多...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a5ae54675783d984c3defd7b2093c91a1"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#a5ae54675783d984c3defd7b2093c91a1">event_t</a> (bool initially=false)</td></tr>
<tr class="memdesc:a5ae54675783d984c3defd7b2093c91a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造一个事件。  <a href="structresumef_1_1event__t.html#a5ae54675783d984c3defd7b2093c91a1">更多...</a><br /></td></tr>
<tr class="separator:a5ae54675783d984c3defd7b2093c91a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3a49adfb8c1cfcfa606cca3148f946a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#ab3a49adfb8c1cfcfa606cca3148f946a">event_t</a> (std::adopt_lock_t)</td></tr>
<tr class="memdesc:ab3a49adfb8c1cfcfa606cca3148f946a"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造一个无效的事件。  <a href="structresumef_1_1event__t.html#ab3a49adfb8c1cfcfa606cca3148f946a">更多...</a><br /></td></tr>
<tr class="separator:ab3a49adfb8c1cfcfa606cca3148f946a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af742aa0454758c3def349cacae86c229"><td class="memItemLeft" align="right" valign="top"><a id="af742aa0454758c3def349cacae86c229"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#af742aa0454758c3def349cacae86c229">~event_t</a> ()</td></tr>
<tr class="memdesc:af742aa0454758c3def349cacae86c229"><td class="mdescLeft">&#160;</td><td class="mdescRight">采用shared_ptr&lt;&gt;来保存内部的事件实现。故不必担心正在被等待的协程，因为事件提前销毁而出现异常。 <br /></td></tr>
<tr class="separator:af742aa0454758c3def349cacae86c229"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac7bf6f81982126225125354769ad695"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#aac7bf6f81982126225125354769ad695">signal_all</a> () const noexcept</td></tr>
<tr class="memdesc:aac7bf6f81982126225125354769ad695"><td class="mdescLeft">&#160;</td><td class="mdescRight">向所有正在等待的协程触发一次信号。  <a href="structresumef_1_1event__t.html#aac7bf6f81982126225125354769ad695">更多...</a><br /></td></tr>
<tr class="separator:aac7bf6f81982126225125354769ad695"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9500bb2438c27adb4b34988eaa04ff9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#ab9500bb2438c27adb4b34988eaa04ff9">signal</a> () const noexcept</td></tr>
<tr class="memdesc:ab9500bb2438c27adb4b34988eaa04ff9"><td class="mdescLeft">&#160;</td><td class="mdescRight">触发一次信号。  <a href="structresumef_1_1event__t.html#ab9500bb2438c27adb4b34988eaa04ff9">更多...</a><br /></td></tr>
<tr class="separator:ab9500bb2438c27adb4b34988eaa04ff9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8da187ffff9c6aee7e9bad6d97af9f4a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#a8da187ffff9c6aee7e9bad6d97af9f4a">reset</a> () const noexcept</td></tr>
<tr class="memdesc:a8da187ffff9c6aee7e9bad6d97af9f4a"><td class="mdescLeft">&#160;</td><td class="mdescRight">重置信号。  <a href="structresumef_1_1event__t.html#a8da187ffff9c6aee7e9bad6d97af9f4a">更多...</a><br /></td></tr>
<tr class="separator:a8da187ffff9c6aee7e9bad6d97af9f4a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9656c785d3c1c1d57560137894aa1be3"><td class="memItemLeft" align="right" valign="top">awaiter&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#a9656c785d3c1c1d57560137894aa1be3">operator co_await</a> () const noexcept</td></tr>
<tr class="memdesc:a9656c785d3c1c1d57560137894aa1be3"><td class="mdescLeft">&#160;</td><td class="mdescRight">在协程中等待信号触发。  <a href="structresumef_1_1event__t.html#a9656c785d3c1c1d57560137894aa1be3">更多...</a><br /></td></tr>
<tr class="separator:a9656c785d3c1c1d57560137894aa1be3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1231525d8406b1f69b563e84dc7fead7"><td class="memItemLeft" align="right" valign="top">awaiter&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#a1231525d8406b1f69b563e84dc7fead7">wait</a> () const noexcept</td></tr>
<tr class="memdesc:a1231525d8406b1f69b563e84dc7fead7"><td class="mdescLeft">&#160;</td><td class="mdescRight">在协程中等待信号触发。  <a href="structresumef_1_1event__t.html#a1231525d8406b1f69b563e84dc7fead7">更多...</a><br /></td></tr>
<tr class="separator:a1231525d8406b1f69b563e84dc7fead7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac3d2ceb787ca321855731e40646d4112"><td class="memTemplParams" colspan="2">template&lt;class _Rep , class _Period &gt; </td></tr>
<tr class="memitem:ac3d2ceb787ca321855731e40646d4112"><td class="memTemplItemLeft" align="right" valign="top">timeout_awaiter&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#ac3d2ceb787ca321855731e40646d4112">wait_for</a> (const std::chrono::duration&lt; _Rep, _Period &gt; &amp;dt) const noexcept</td></tr>
<tr class="memdesc:ac3d2ceb787ca321855731e40646d4112"><td class="mdescLeft">&#160;</td><td class="mdescRight">在协程中等待信号触发，直到超时。  <a href="structresumef_1_1event__t.html#ac3d2ceb787ca321855731e40646d4112">更多...</a><br /></td></tr>
<tr class="separator:ac3d2ceb787ca321855731e40646d4112"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a083cda88807a10c4f68b134ce32c597b"><td class="memTemplParams" colspan="2">template&lt;class _Clock , class _Duration &gt; </td></tr>
<tr class="memitem:a083cda88807a10c4f68b134ce32c597b"><td class="memTemplItemLeft" align="right" valign="top">timeout_awaiter&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structresumef_1_1event__t.html#a083cda88807a10c4f68b134ce32c597b">wait_until</a> (const std::chrono::time_point&lt; _Clock, _Duration &gt; &amp;tp) const noexcept</td></tr>
<tr class="memdesc:a083cda88807a10c4f68b134ce32c597b"><td class="mdescLeft">&#160;</td><td class="mdescRight">在协程中等待信号触发，直到超时。  <a href="structresumef_1_1event__t.html#a083cda88807a10c4f68b134ce32c597b">更多...</a><br /></td></tr>
<tr class="separator:a083cda88807a10c4f68b134ce32c597b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>用于协程的事件。 </p>
<p>用于同步不同线程里运行的协程。 </p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="a5ae54675783d984c3defd7b2093c91a1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5ae54675783d984c3defd7b2093c91a1">&#9670;&nbsp;</a></span>event_t() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">resumef::event_t::event_t </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>initially</em> = <code>false</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>构造一个事件。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">initially</td><td>初始是否触发一次信号。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ab3a49adfb8c1cfcfa606cca3148f946a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3a49adfb8c1cfcfa606cca3148f946a">&#9670;&nbsp;</a></span>event_t() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">resumef::event_t::event_t </td>
          <td>(</td>
          <td class="paramtype">std::adopt_lock_t&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>构造一个无效的事件。 </p>
<p>如果用于后续保存另外一个事件，则应当使用此构造函数，便于节省一次不必要的内部初始化。 </p>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a9656c785d3c1c1d57560137894aa1be3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9656c785d3c1c1d57560137894aa1be3">&#9670;&nbsp;</a></span>operator co_await()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">awaiter resumef::event_t::operator co_await </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>在协程中等待信号触发。 </p>
<dl class="section see"><dt>参见</dt><dd>等同于co_await <a class="el" href="structresumef_1_1event__t.html#a1231525d8406b1f69b563e84dc7fead7" title="在协程中等待信号触发。">wait()</a>。 </dd></dl>
<dl class="section attention"><dt>注意</dt><dd>只能在协程中调用。 </dd></dl>

</div>
</div>
<a id="a8da187ffff9c6aee7e9bad6d97af9f4a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8da187ffff9c6aee7e9bad6d97af9f4a">&#9670;&nbsp;</a></span>reset()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void resumef::event_t::reset </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>重置信号。 </p>
<dl class="section attention"><dt>注意</dt><dd>非协程中也可以使用。 </dd></dl>

</div>
</div>
<a id="ab9500bb2438c27adb4b34988eaa04ff9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab9500bb2438c27adb4b34988eaa04ff9">&#9670;&nbsp;</a></span>signal()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void resumef::event_t::signal </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>触发一次信号。 </p>
<p>如果有正在等待的协程，则最先等待的协程会被唤醒。<br  />
如果没有正在等待的协程，则信号触发次数加一。之后有协程调用wait()，则会直接返回。 </p><dl class="section attention"><dt>注意</dt><dd>非协程中也可以使用。 </dd></dl>

</div>
</div>
<a id="aac7bf6f81982126225125354769ad695"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aac7bf6f81982126225125354769ad695">&#9670;&nbsp;</a></span>signal_all()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void resumef::event_t::signal_all </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>向所有正在等待的协程触发一次信号。 </p>
<dl class="section attention"><dt>注意</dt><dd>非协程中也可以使用。 </dd></dl>

</div>
</div>
<a id="a1231525d8406b1f69b563e84dc7fead7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1231525d8406b1f69b563e84dc7fead7">&#9670;&nbsp;</a></span>wait()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">awaiter resumef::event_t::wait </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>在协程中等待信号触发。 </p>
<p>如果信号已经触发，则立即返回true。<br  />
否则，当前协程被阻塞，直到信号被触发后唤醒。 消耗一次信号触发次数。 </p><dl class="retval"><dt>返回值</dt><dd>
  <table class="retval">
    <tr><td class="paramname">bool</td><td>[co_await] 返回是否等到了信号 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section attention"><dt>注意</dt><dd>只能在协程中调用。 </dd></dl>

</div>
</div>
<a id="ac3d2ceb787ca321855731e40646d4112"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac3d2ceb787ca321855731e40646d4112">&#9670;&nbsp;</a></span>wait_for()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class _Rep , class _Period &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">timeout_awaiter resumef::event_t::wait_for </td>
          <td>(</td>
          <td class="paramtype">const std::chrono::duration&lt; _Rep, _Period &gt; &amp;&#160;</td>
          <td class="paramname"><em>dt</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>在协程中等待信号触发，直到超时。 </p>
<p>如果信号已经触发，则立即返回true。<br  />
否则，当前协程被阻塞，直到信号被触发后，或者超时后唤醒。 如果等到了信号，则消耗一次信号触发次数。 </p><dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">dt</td><td>超时时长 </td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>返回值</dt><dd>
  <table class="retval">
    <tr><td class="paramname">bool</td><td>[co_await] 等到了信号返回true，超时了返回false。 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section attention"><dt>注意</dt><dd>只能在协程中调用。 </dd></dl>

</div>
</div>
<a id="a083cda88807a10c4f68b134ce32c597b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a083cda88807a10c4f68b134ce32c597b">&#9670;&nbsp;</a></span>wait_until()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class _Clock , class _Duration &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">timeout_awaiter resumef::event_t::wait_until </td>
          <td>(</td>
          <td class="paramtype">const std::chrono::time_point&lt; _Clock, _Duration &gt; &amp;&#160;</td>
          <td class="paramname"><em>tp</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>在协程中等待信号触发，直到超时。 </p>
<p>如果信号已经触发，则立即返回true。<br  />
否则，当前协程被阻塞，直到信号被触发后，或者超时后唤醒。 如果等到了信号，则消耗一次信号触发次数。 </p><dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">tp</td><td>超时时刻 </td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>返回值</dt><dd>
  <table class="retval">
    <tr><td class="paramname">bool</td><td>[co_await] 等到了信号返回true，超时了返回false。 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section attention"><dt>注意</dt><dd>只能在协程中调用。 </dd></dl>

</div>
</div>
<hr/>该结构体的文档由以下文件生成:<ul>
<li>librf/src/<a class="el" href="event__v2_8h_source.html">event_v2.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
